package org.alex.samples.model;

import java.io.Serializable;
import java.util.Date;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotEmpty;


@Entity
@Table(name = "exam_user")
public class User  implements Serializable{
	
	private static final long serialVersionUID = 6912421004179949701L;
	
	@Id
	@Column(name = "user_id",nullable = false,length = 10)
	@GeneratedValue
//	@NotNull(message = "ID不可以为空!")
	private Integer id;
	
	@NotEmpty(message = "名字不可以为空!")
	@Length(min=1, max =15 ,message = "长度为1到15个字符")
	@Column(name = "user_name",nullable = false,length = 255)
	private String name;
	
	@Column(name = "password",nullable = false,length = 255)
	private String password;
	

	//@Range(min = 1,max = 250, message = "年龄只能为1到250的整数")
	@Column(name = "tel",nullable = false,length = 255)
	private String tel;
	
	@Column(name = "email",nullable = false,length = 255)
	private String email;
	
	@Column(name = "birthday",nullable = false,length = 10)
	private Date birthday;
	@Column(name = "address",nullable = false,length = 255)
	private String address;
	
	@Column(name = "gender",nullable = false,length = 1)
	private int gender;
	
	@Column(name = "last_lock_time",nullable = false,length = 10)
	private Date last_lock_time;
	
	@Column(name = "login_fail_count",nullable = false,length = 1)
	private int login_fail_count;
	
	@OneToMany(mappedBy = "user")
	private Set<ExamUserSubject> examUserSubject;
	
	public Set<ExamUserSubject> getExamUserSubject() {
		return examUserSubject;
	}



	public void setExamUserSubject(Set<ExamUserSubject> examUserSubject) {
		this.examUserSubject = examUserSubject;
	}



	public User(){
		super();
	}



	public Integer getId() {
		return id;
	}



	public void setId(Integer id) {
		this.id = id;
	}



	public String getName() {
		return name;
	}



	public void setName(String name) {
		this.name = name;
	}



	public String getPassword() {
		return password;
	}



	public void setPassword(String password) {
		this.password = password;
	}



	public String getTel() {
		return tel;
	}



	public void setTel(String tel) {
		this.tel = tel;
	}



	public String getEmail() {
		return email;
	}



	public void setEmail(String email) {
		this.email = email;
	}



	public Date getBirthday() {
		return birthday;
	}



	public void setBirthday(Date birthday) {
		this.birthday = birthday;
	}



	public String getAddress() {
		return address;
	}



	public void setAddress(String address) {
		this.address = address;
	}



	public int getGender() {
		return gender;
	}



	public void setGender(int gender) {
		this.gender = gender;
	}



	public Date getLast_lock_time() {
		return last_lock_time;
	}



	public void setLast_lock_time(Date last_lock_time) {
		this.last_lock_time = last_lock_time;
	}



	public int getLogin_fail_count() {
		return login_fail_count;
	}



	public void setLogin_fail_count(int login_fail_count) {
		this.login_fail_count = login_fail_count;
	}



	public static long getSerialversionuid() {
		return serialVersionUID;
	}
	
	
	
	
	
}
